using UnityEngine;
using System.Collections.Generic;

public class BallList : MonoBehaviour 
{	
	public bool ballSpeedSlow = false;
	
	public List<GameObject> balls = new List<GameObject>();
		
	public GameObject CreateBall(GameObject obj, Vector3 pos, Quaternion rot, Color color) 
	{					
		GameObject ball = (GameObject) Instantiate(obj, pos, rot);
		ball.renderer.material.color = color;
		balls.Add(ball);
		
		return ball;
	}
		
	public void DestroyBalls() 
	{		
		foreach(GameObject b in balls)
		{
			Destroy(b);
		}
		
		balls.Clear();
	}
	
	public void DestroyBall(GameObject ball) 
	{
		if (balls.Remove(ball))
		{
			Destroy(ball);
		}
	}
}
